package main

import "fmt"

type Pensioner interface {
	SayHello()
}

type Student struct {
}

func (s *Student) SayHello() {
	fmt.Println("老师好")
}

type Teacher struct {
}

func (t *Teacher) SayHello() {
	fmt.Println("同学们好")
}

func whoSayHi(p Pensioner) {
	p.SayHello()
}

func main() {
	var stu Student
	var teacher Teacher
	//var person Pensioner
	//person = &stu
	//person.SayHello()
	//person = &teacher
	//person.SayHello()
	whoSayHi(&stu)
	whoSayHi(&teacher)
}
